import requestProxy from '@/utils/request';

const { request } = requestProxy;

// 新建基础字段接口
export function addField(data) {
  return request({
    url: '/admin/field/addField',
    method: 'post',
    data
  });
}

// 编辑字段
export function editField(data) {
  return request({
    url: '/admin/field/editField',
    method: 'post',
    data
  });
}

// 获取字段列表
export function getFieldList(params) {
  return request({
    url: '/admin/field/list',
    method: 'get',
    params
  });
}

// 获取字段详情
export function getFieldDetail(params) {
  return request({
    url: '/admin/field/info',
    method: 'get',
    params
  });
}

// 删除字段
export function deleteField(params) {
  return request({
    url: '/admin/field/del',
    method: 'delete',
    params
  });
}

// 批量导入字段
export function batchField(data) {
  return request({
    url: '/admin/field/batchAddField',
    method: 'post',
    data
  });
}

// 字段设置-搜索条件值接口
export function searchCondition(params) {
  return request({
    url: '/admin/field/search/condition',
    method: 'get',
    params
  });
}

export function addFieldType(data) {
  return request({
    url: '/admin/field/category/add',
    method: 'post',
    data
  });
}
export function editFieldType(data) {
  return request({
    url: '/admin/field/category/edit',
    method: 'put',
    data
  });
}
export function deleteFieldType(data) {
  return request({
    url: '/admin/field/category/delete/' + data.id,
    method: 'delete'
  });
}
